package com.fm.magic.net.chrome;

import com.fm.base.json.JsonObject;
import com.fm.base.json.JsonReaderFactory;
import com.fm.commons.json.BasicJsonArray;
import com.fm.commons.json.BasicJsonObject;
import com.fm.commons.json.BasicJsonReaderFactory;
import com.neovisionaries.ws.client.WebSocket;
import com.neovisionaries.ws.client.WebSocketAdapter;

/**
 * @author leo.li
 */
public class ChromeWebSocketListener extends WebSocketAdapter {
    private JsonReaderFactory factory = new BasicJsonReaderFactory();

    @Override
    public void onTextMessage(WebSocket websocket, String text) throws Exception {
        JsonObject result = factory.createJsonReader(text, BasicJsonObject::new, BasicJsonArray::new).readJsonObject();
    }
}
